home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Dev
/
GameboyDev
/
GBDK
/
lib
/
strncmp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-03-29
|
288b
|
19 lines
#include <string.h>
/*
* Compare strings (at most n bytes):
* s1>s2: >0
* s1==s2: 0
* s1<s2: <0
*/
BYTE strncmp(const char *s1, const char *s2, UBYTE n)
{
while(n > 0 && *s1 == *s2++) {
if(*s1++ == '\0')
return 0;
n--;
}
return (n == 0 ? 0 : *s1 - *--s2);
}